//
//  SeeSeeboundController.swift
//  maopu
//
//  Created by huazi on 2017/5/1.
//  Copyright © 2017年 maopu. All rights reserved.
//

import UIKit

class SeeSeeboundController: BaseViewController {
    fileprivate var btnPop: UIButton!
    fileprivate var labelDes: UILabel!
    fileprivate var btnContinueBind: UIButton!
    fileprivate var btnCancel: UIButton!
    fileprivate var imageUpArrow: UIImageView!
    fileprivate var labelTips: UILabel!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.initView()
        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */
    fileprivate func initView() {
        self.btnPop = UIButton.init(frame: CGRect.init(x: 0, y: 20, width: 44, height: 44))
        self.btnPop.setImage(UIImage.init(named: "back"), for: .normal)
        self.btnPop.addTarget(self, action: #selector(self.goBack), for: .touchUpInside)
        self.view.addSubview(self.btnPop)
        
        var top: CGFloat = 100.0
        let left: CGFloat = 15.0
        let btnHeight: CGFloat = 40.0
        
        self.labelDes = UILabel.init(frame: CGRect.init(x: 0, y: top, width: AppWidth, height: 50))
        self.labelDes.font = UIFont.LightDefaultFont(15.0)
        self.labelDes.textColor = UIColor.black
        self.labelDes.numberOfLines = 2
        self.labelDes.textAlignment = .center
        self.labelDes.text = "该手机已绑定于账号" + "\n" + "“我的小小鸟”"
        self.view.addSubview(self.labelDes)
        
        top = AppHeight - 200.0
        
        self.btnContinueBind = UIButton.init(frame: CGRect.init(x: left, y: top, width: AppWidth-2*left, height: btnHeight))
        self.btnContinueBind.setBackgroundImage(UIImage.createImageWithColor(color: UIColor.colorWithHexString(hex: "#ffce54")), for: .normal)
        self.btnContinueBind.setBackgroundImage(UIImage.createImageWithColor(color: UIColor.colorWithHexString(hex: "#dcb34c")), for: .highlighted)
        self.btnContinueBind.setTitle("继续绑定", for: .normal)
        self.btnContinueBind.setCornerRadius(radius: 20.0)
        self.btnContinueBind.titleLabel?.font = UIFont.LightDefaultFont(13.0)
        self.btnContinueBind.setTitleColor(UIColor.black, for: .normal)
        self.btnContinueBind.addTarget(self, action: #selector(btnContinueBindClick), for: .touchUpInside)
        self.view.addSubview(self.btnContinueBind)
        top += btnHeight + 20.0
        
        self.btnCancel = UIButton.init(frame: CGRect.init(x: left, y: top, width: AppWidth-2*left, height: btnHeight))
        self.btnCancel.setBackgroundImage(UIImage.createImageWithColor(color: UIColor.colorWithHexString(hex: "#f7f7f7")), for: .normal)
        self.btnCancel.setBackgroundImage(UIImage.createImageWithColor(color: UIColor.colorWithHexString(hex: "#f1f1f1")), for: .highlighted)
        self.btnCancel.setTitle("取消", for: .normal)
        self.btnCancel.setCornerRadius(radius: 20.0)
        self.btnCancel.titleLabel?.font = UIFont.LightDefaultFont(13.0)
        self.btnCancel.setTitleColor(UIColor.black, for: .normal)
        self.btnCancel.layer.borderColor = UIColor.colorWithHexString(hex: "#f1f1f1").cgColor
        self.btnCancel.layer.borderWidth = 1.0
        self.btnCancel.addTarget(self, action: #selector(btnCancelClick), for: .touchUpInside)
        self.view.addSubview(self.btnCancel)
        top += btnHeight + 30.0
        
        self.imageUpArrow = UIImageView.init(frame: CGRect.init(x: left, y: top, width: AppWidth - 2*left, height: 2))
        self.imageUpArrow.image = UIImage.createImageWithColor(color: UIColor.colorWithHexString(hex: "#f1f1f1"));
        self.view.addSubview(self.imageUpArrow)
        
        self.labelTips = UILabel.init(frame: CGRect.init(x: left, y: AppHeight-60, width: AppWidth - 2*left, height: 40))
        self.labelTips.font = UIFont.LightDefaultFont(11.0)
        self.labelTips.numberOfLines = 2
//         NSMutableAttributedString 
        self.labelTips.text = "选择继续绑定，将解除与原账户的绑定关系，原账户不可食用手机号作为直接登录方式"
        self.view.addSubview(self.labelTips)

    }
    
    @objc fileprivate func btnContinueBindClick(){
        let vc = SeeSeeBindPhoneController()
        self.navigationController?.pushViewController(vc, animated: true)
    }
    @objc fileprivate func btnCancelClick(){
        _ = self.navigationController?.popViewController(animated: true)
    }
    
}
